/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 *
 * @author ori
 */
@Embeddable
public class TransportationPK implements Serializable {
    @Basic(optional = false)
    @Column(name = "waypoint1")
    private int waypoint1;
    @Basic(optional = false)
    @Column(name = "waypoint2")
    private int waypoint2;
    @Basic(optional = false)
    @Column(name = "transportType")
    private String transportType;

    public TransportationPK() {
    }

    public TransportationPK(int waypoint1, int waypoint2, String transportType) {
        this.waypoint1 = waypoint1;
        this.waypoint2 = waypoint2;
        this.transportType = transportType;
    }

    public int getWaypoint1() {
        return waypoint1;
    }

    public void setWaypoint1(int waypoint1) {
        this.waypoint1 = waypoint1;
    }

    public int getWaypoint2() {
        return waypoint2;
    }

    public void setWaypoint2(int waypoint2) {
        this.waypoint2 = waypoint2;
    }

    public String getTransportType() {
        return transportType;
    }

    public void setTransportType(String transportType) {
        this.transportType = transportType;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) waypoint1;
        hash += (int) waypoint2;
        hash += (transportType != null ? transportType.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TransportationPK)) {
            return false;
        }
        TransportationPK other = (TransportationPK) object;
        if (this.waypoint1 != other.waypoint1) {
            return false;
        }
        if (this.waypoint2 != other.waypoint2) {
            return false;
        }
        if ((this.transportType == null && other.transportType != null) || (this.transportType != null && !this.transportType.equals(other.transportType))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.TransportationPK[waypoint1=" + waypoint1 + ", waypoint2=" + waypoint2 + ", transportType=" + transportType + "]";
    }

}
